#!/usr/bin/env python
# coding=utf-8

# author: Reggie
# time:   2019/11/12 上午9:41

import socket
import sys

if  sys.version_info.major == 2:
    input = raw_input

flag = 1
s = socket.socket()
s.connect(('127.0.0.1', 8888))
while flag:
    input_msg = input('input>>>')
    if input_msg == '0':
        break
    s.sendall(input_msg.encode())
    msg = s.recv(1024)
    print(msg.decode())

s.close()